home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1177 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: ornews.intel.com!news
  2. From: thurman_b_miller@ccm2.hf.intel.com (Thurman Miller)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Need suggestion!
  5. Date: Tue, 09 Jan 1996 18:23:49 GMT
  6. Organization: Intel Corporation
  7. Message-ID: <4cubu3$sme@ornews.intel.com>
  8. References: <4ctnuc$9at@eng_ser1.erg.cuhk.hk>
  9. NNTP-Posting-Host: thurman-pc.ssd.intel.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. ywleung@cs.cuhk.hk (Marty McFly) wrote:
  13.  
  14. >Dear All,
  15.  
  16. >    I am writing the user-interface of a program.  The program will
  17. >prompt some message dialogs.  The user can click the button inside the
  18. >dialog and then it will disappear.  My question is:  Is it a good way to
  19. >create the dialog each time and "delete" it when the button is clicked?
  20. >("delete" means freeing the memory)  In fact, the message prompting process
  21. >is very frequent.  Will it cause the program to become unstable?
  22.  
  23. >Regards,
  24. >Marty McFly.
  25.  
  26. I doubt if it will make the program unstable, but it will use a lot of
  27. resources if you are constantly creating and then destroying the
  28. dialog box.
  29.  
  30. The best way is to make it modeless (use create to instantiate it) and
  31. then use member function ShowWindow to either show or hide it. This
  32. way, it's always around and you are simply making it either visible or
  33. invisible. BTW, it will probably be a lot easier if you create a
  34. member function of your app that does the show window so you can
  35. re-initialize the buttons/controls to their "initial" state.
  36.  
  37. Thurman Miller
  38.  
  39.  
  40.